{extend name="layout:base" /}
{block name="main_content"}
  <div class="page-content">
    <!--主题-->
    <?php if(!empty($current_page)): ?>
      <div class="page-header">
        <h1>
          您当前操作
          <small>
            <i class="ace-icon fa fa-angle-double-right"></i>
            {$current_page.title|default=''}
          </small>
        </h1>
      </div>
    <?php endif; ?>
    <div class="row">
      <?php if(!empty($notice)): ?>
        <div class="alert alert-block alert-success">
          <button type="button" class="close" data-dismiss="alert">
            <i class="ace-icon fa fa-times"></i>
          </button>
          <i class="ace-icon fa fa-check green"></i>
          {$notice}
        </div>
      <?php endif; ?>
      <div class="tabbable">
        <ul class="nav nav-tabs" id="myTab">
          <li class="active">
            <a data-toggle="tab" href="#basic">
              基本设置
            </a>
          </li>
          <li>
            <a data-toggle="tab" href="#contact">
              联系方式
            </a>
          </li>
          <li class="dropdown">
            <a data-toggle="tab" href="#seo">
              SEO设置
            </a>
          </li>
        </ul>
        <form id="settings-form" class="form-horizontal" method="post" action="{:url('site')}">
          <fieldset>
            <div class="tab-content">
              <div id="basic" class="tab-pane fade in active">
                <div class="form-group">
                  <label class="col-sm-3 control-label no-padding-right" for="form-field-1">
                    站点名称
                  </label>
                  <div class="col-sm-9">
                    <input type="text" name="options[site_name]" id="site_name" value="{$options.site_name|default=''}" class="col-xs-10 col-sm-5" required/>
                    <span class="help-inline col-xs-12 col-sm-7">
                      <span class="middle" id="resone">*</span>
                    </span>
                  </div>
                </div>
                <div class="space-4"></div>

                <div class="form-group">
                  <label class="col-sm-3 control-label no-padding-right" for="form-field-1">
                    站点网址
                  </label>
                  <div class="col-sm-9">
                    <input type="text" name="options[site_host]" id="site_host" value="{$options.site_host|default=''}"  class="col-xs-10 col-sm-5" required/>
                    <span class="help-inline col-xs-12 col-sm-7">
                      <span class="middle" id="restwo">*</span>
                    </span>
                  </div>
                </div>
                <div class="space-4"></div>


                <div class="form-group">
                  <label class="col-sm-3 control-label no-padding-right" for="form-field-1">
                    备案信息
                  </label>
                  <div class="col-sm-9">
                    <input type="text" name="options[site_icp]" id="site_icp" value="{$options.site_icp|default=''}"  class="col-xs-10 col-sm-5" />
                  </div>
                </div>
                <div class="space-4"></div>

                <div class="form-group">
                  <label class="col-sm-3 control-label no-padding-right" for="form-field-1">
                    统计代码
                  </label>
                  <div class="col-sm-9">
                    <textarea  name="options[site_tongji]" cols="20" rows="2" class="col-xs-10 col-sm-7 limited"   id="form-field-9">{$options.site_tongji|default=''}</textarea>
                  </div>
                </div>
                <div class="space-4"></div>

                <div class="form-group">
                  <label class="col-sm-3 control-label no-padding-right" for="form-field-1"> 版权信息 </label>
                  <div class="col-sm-9">
                    <textarea  name="options[site_copyright]" cols="20" rows="3" class="col-xs-10 col-sm-7 limited1"   id="form-field-10">{$options.site_copyright|default=''}</textarea>
                  </div>
                </div>
                <div class="space-4"></div>
              </div>

              <div id="contact" class="tab-pane fade">
                <div class="form-group">
                  <label class="col-sm-3 control-label no-padding-right" for="form-field-1">
                    公司名称
                  </label>
                  <div class="col-sm-9">
                    <input type="text" name="options[site_co_name]" id="site_co_name" value="{$options.site_co_name|default=''}" class="col-xs-10 col-sm-5" />
                  </div>
                </div>
                <div class="space-4"></div>

                <div class="form-group">
                  <label class="col-sm-3 control-label no-padding-right" for="form-field-1">
                    公司地址
                  </label>
                  <div class="col-sm-9">
                    <input type="text" name="options[site_address]" id="site_address" value="{$options.site_address|default=''}"  class="col-xs-10 col-sm-5" />
                  </div>
                </div>
                <div class="space-4"></div>

                <div class="form-group">
                  <label class="col-sm-3 control-label no-padding-right" for="form-field-1">
                    联系电话
                  </label>
                  <div class="col-sm-9">
                    <input type="text" name="options[site_tel]" id="site_tel" value="{$options.site_tel|default=''}"  class="col-xs-10 col-sm-5" />
                  </div>
                </div>
                <div class="space-4"></div>

                <div class="form-group">
                  <label class="col-sm-3 control-label no-padding-right" for="form-field-1">
                    站长邮箱
                  </label>
                  <div class="col-sm-9">
                    <input type="email" name="options[site_admin_email]" id="site_admin_email" value="{$options.site_admin_email|default=''}"  class="col-xs-10 col-sm-5" />
                  </div>
                </div>
                <div class="space-4"></div>

                <div class="form-group">
                  <label class="col-sm-3 control-label no-padding-right" for="form-field-1">
                    站长QQ
                  </label>
                  <div class="col-sm-9">
                    <input type="number" name="options[site_qq]" id="site_qq" value="{$options.site_qq|default=''}"  class="col-xs-10 col-sm-5" />
                  </div>
                </div>
                <div class="space-4"></div>
              </div>

              <div id="seo" class="tab-pane fade">
                <div class="form-group">
                  <label class="col-sm-3 control-label no-padding-right" for="form-field-1">
                    首页SEO标题
                  </label>
                  <div class="col-sm-9">
                    <input type="text" name="options[site_seo_title]" id="site_seo_title" value="{$options.site_seo_title|default=''}"  class="col-xs-10 col-sm-5" />
                  </div>
                </div>
                <div class="space-4"></div>

                <div class="form-group">
                  <label class="col-sm-3 control-label no-padding-right" for="form-field-1">
                    首页SEO关键字
                  </label>
                  <div class="col-sm-9">
                    <textarea  name="options[site_seo_keywords]" cols="20" class="col-xs-10 col-sm-7 limited2"  id="form-field-11">{$options.site_seo_keywords|default=''}</textarea>
                  </div>
                </div>
                <div class="space-4"></div>

                <div class="form-group">
                  <label class="col-sm-3 control-label no-padding-right" for="form-field-1">
                    首页SEO描述
                  </label>
                  <div class="col-sm-9">
                    <textarea name="options[site_seo_description]" cols="20" rows="4" class="col-xs-10 col-sm-7 limited3" id="form-field-12">{$options.site_seo_description|default=''}</textarea>
                  </div>
                </div>
                <div class="space-4"></div>
              </div>
            </div>
            <div class="clearfix form-actions">
              <div class="col-sm-offset-3 col-sm-9">
                <button class="btn btn-info" type="submit">
                  <i class="ace-icon fa fa-check bigger-110"></i>
                  保存
                </button>

                &nbsp; &nbsp; &nbsp;
                <button class="btn" type="reset">
                  <i class="ace-icon fa fa-undo bigger-110"></i>
                  重置
                </button>
              </div>
            </div>
          </fieldset>
        </form>
      </div>
    </div>
  </div><!-- /.page-content -->
{/block}
{block name="page_js"}
  <script src="{$site_root}/static/plugins/jquery-validate/jquery.validate.min.js"></script>
  <script type="text/javascript">
    $("form#settings-form").validate({
      rules:{
        "options[site_name]":{
          required: true
        }, "options[site_host]":{
          required: true,
          url: true
        }, "options[site_tel]":{
          required: true,
          minlength: 10,
          maxlength: 15
        }, "options[site_admin_email]":{
          required: true,
          email: true,
          maxlength: 50
        }
      },
      messages:{
        "options[site_name]":{
          required: "站点名称不能为空",
          minlength: "站点名称不能少于3个字符",
          maxlength: "站点名称不能超过60个字符"
        }, "options[site_host]":{
          required: "站点网址不能为空",
          url: "站点网址格式不正确"
        }, "options[site_tel]":{
          required: "联系电话不能为空",
          minlength: "联系电话格式不正确",
          maxlength: "联系电话格式不正确"
        }, "options[site_admin_email]":{
          required: "站长邮箱不能为空",
          email: "站长邮箱格式不正确",
          maxlength: "站长邮箱格式不正确"
        }
      },
      errorClass: "help-inline input-error",
      errorElement: "span",
      highlight:function(element, errorClass, validClass) {
        $(element).parents('.form-group').addClass('has-error');
      },
      unhighlight: function(element, errorClass, validClass) {
        $(element).parents('.form-group').removeClass('has-error');
        // $(element).parents('.form-group').addClass('success');
      }
    });
  </script>
{/block}